<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../Template/generalTemplate.xhtml">


            <ui:define name="content">
                <h:form id="form">
                 <p:panel id="salesInquiryList" header="Sales Inquiry List" style="height:495px;">
                     <div style="margin-top:20px;margin-left:50px;margin-right:50px;margin-bottom:20px;"> 
                     <p:dataTable id="inquiry" dynamic="true" emptyMessage="No Sales Inquiry has been Created" value="#{deleteSalesInquiryManagedBean.getSalesInquiry()}" var ="o" paginator="true" rows="7">

                      <p:column style="width:200px;">
                         <f:facet name="header">Sales Inquiry ID</f:facet>
                         #{o.id}
                      </p:column>

                      <p:column>
                         <f:facet name="header">Company</f:facet>
                         #{o.company.name}
                      </p:column> 

                      <p:column style="width:65px;">
                         <f:facet name="header">Action</f:facet>
                         
                         <p:commandButton onclick="viewSalesInquiry.show()" image="ui-icon ui-icon-search" title="View">
                             <f:setPropertyActionListener value="#{o}" target="#{deleteSalesInquiryManagedBean.selectedSalesInquiry}" />
                         </p:commandButton>
                         
                         <p:commandButton update=":form:display" oncomplete="confirmation.show()" image="ui-icon ui-icon-close" title="Delete">  
                             <f:setPropertyActionListener value="#{o}" target="#{deleteSalesInquiryManagedBean.selectedSalesInquiry}" />  
                         </p:commandButton>

                      </p:column>        
                     </p:dataTable>
                     </div>
                    
                    <p:confirmDialog message="Are you sure to delete?" 
                             showEffect="explode" hideEffect="explode"  
                             header="Confirm" severity="alert" widgetVar="confirmation">  

                        <p:commandButton value="Confirm" update="inquiry" actionListener="#{deleteSalesInquiryManagedBean.deleteSalesInquiry}" oncomplete="confirmation.hide()">  
                           
                            <f:attribute name="deleteInquiry" value="#{deleteSalesInquiryManagedBean.selectedSalesInquiry.id}" />
                        </p:commandButton>
                        <p:commandButton value="Cancel" onclick="confirmation.hide()" type="button" />  

                    </p:confirmDialog>
                    
                    <p:dialog header="Confirm" widgetVar="viewSalesInquiry" showEffect="explode" hideEffect="explode">  
                        <h:outputText value="View the inquiry detail?" />
                        <br /><br />
                        <p:commandButton value="Confirm" actionListener="#{deleteSalesInquiryManagedBean.viewInquiry}" oncomplete="viewSalesInquiry.hide()">
                             <f:attribute name="viewInquiry" value="#{deleteSalesInquiryManagedBean.selectedSalesInquiry}" />
                        </p:commandButton>
                        <p:commandButton value="Cancel" onclick="viewSalesInquiry.hide()" type="button" />
                    </p:dialog> 
                     
                 </p:panel>
               </h:form>
                
              
                
            </ui:define>


        </ui:composition>

    </body>
</html>
